<!--
 * @company : 版权所属 四川北星惯牌科技有限公司
 * @contact : 刘经理 19326416371
 -->
<template>
	<view class="team-item w100" @click="toTeamDetails">
		<view class="team-head-content w100">
			<image :src="matchInfo.imageList[0]" class="item-img" mode="aspectFill"></image>
			<!-- 队长信息 -->
			<view class="team-head flex-row-center w100">
				<view class="team-user flex-row-center">
					<text class="user-name">{{matchInfo.name}}</text>
				</view>
				<!--  -->
				<!-- <view class="details-item flex-row-center">
					<up-icon name="map-fill" color="#E4E4E5" size="24rpx"></up-icon>
					<text class="text">{{matchInfo.juli}}km</text>
				</view> -->
				<view class="description-right flex-row-center">
					<image src="../../static/activity/navigation_icon.png" class="icon" mode=""></image>
					<text class="address">{{matchInfo.district_text}}</text>
					<text class="interval"></text>
					<text class="distanc">{{matchInfo.juli}}km</text>
				</view>
			</view>
			<!-- 状态 -->
			<template v-if="matchInfo.countDownInfo">
				<view class="state-content ing flex-center" v-if="matchInfo.countDownInfo.status==3">
					<text class="text">进行中</text>
				</view>
				<view class="state-content sginOver flex-center" v-else-if="matchInfo.countDownInfo.status==2">
					<text class="text">报名结束</text>
				</view>
				<view class="state-content signIng flex-center" v-else-if="matchInfo.countDownInfo.status==1">
					<text class="text">报名中</text>
				</view>
				<view class="state-content noStart flex-center" v-if="matchInfo.countDownInfo.status==0">
					<text class="text">未开始</text>
				</view>
				<view class="state-content over flex-center" v-else-if="matchInfo.countDownInfo.status==-1">
					<text class="text">已结束</text>
				</view>
			</template>
		</view>
		<!-- 内容 -->
		<view class="item-content w100 ">
			<view class="content-top w100 flex-row-center">
				<view class="item-name-box flex-row-center w100">
					<up-icon name="map-fill" color="#A5A6A7" size="24rpx"></up-icon>
					<text class="item-name">{{matchInfo.address}}</text>
				</view>
				<!-- 倒计时 -->
				<view class="countdown-box  flex-center"
					v-if="matchInfo.countDownInfo&&matchInfo.countDownInfo?.status!=-1&&matchInfo.countDownInfo?.status!=3">
					<up-icon name="clock" color="#A5A6A7" size="24rpx"></up-icon>
					<view class="time-box flex-row-center">
						<template>
							<text class="text">倒计时</text>
							<text class="time">{{matchInfo.countDownInfo.day}}</text>
							<text class="text">天</text>
							<text class="time">{{matchInfo.countDownInfo.hour}}</text>
							<text class="text">时</text>
							<text class="time">{{matchInfo.countDownInfo.minute}}</text>
							<text class="text">分</text>
						</template>
					</view>
				</view>
			</view>
			<!-- 倒计时 -->
			<view class="item-details flex-row-center w100">
				<view class="price-box">
					<text class="icon">￥</text>
					<text class="price">{{matchInfo.cost}}</text>
					<text class="unit">/人</text>
				</view>

				<!-- 按钮 -->
				<view class="item-border-active item-btn flex-center">
					<view class="btn-left flex-center">
						<!-- 座位情况 -->
						<text class="seat">{{matchInfo.join_count}}/{{matchInfo.people_count}}已报名</text>
						<up-avatar-group :default-url="errImg" mode="aspectFill" :maxCount="3"
							:urls="matchInfo.avatarList" size="36rpx" font-size="18rpx" gap="0.1"></up-avatar-group>
					</view>
					<view class="btn-right flex-center">
						<text class="text">立即参赛</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	const props = defineProps({
		teamInfo: {
			default: {}
		}
	});
	import {
		configInfoStore
	} from '@/stores/config.js';
	const {
		configInfo
	} = configInfoStore();
	const errImg = ref(computed(() => configInfo.user_default_avatar?.value))
	const matchInfo = ref(computed(() => props.matchInfo));
	const toTeamDetails = () => {
		uni.navigateTo({
			url: '/page_activity/views/activityDetails?id=' + matchInfo.value.m_id
		})
	}
</script>

<style scoped lang="scss">
	.item-img {
		width: 100%;
		height: 100%;
		position: absolute;
		top: 0;
		left: 0;
		border-radius: 16rpx;
		flex-shrink: 0;
		z-index: 0;
	}

	.team-item {
		border-radius: 20rpx;
		margin-bottom: 16rpx;
		position: relative;
		overflow: hidden;
		background-color: #0E0F0F;
	}

	.team-head-content {
		box-sizing: border-box;
		width: 100%;
		height: 350rpx;
		position: relative;
	}



	.state-content {
		border-radius: 0 16rpx 0 16rpx;
		position: absolute;
		bottom: 0;
		left: 0;
		z-index: 99;
		height: 42rpx;
		width: 180rpx;
	}

	.ing {
		background-color: #fa3534;
	}

	.signIng {
		background-color: #5ac725;
	}

	.sginOver {
		background-color: #f1a532;
	}

	.noStart {
		// background: $btn-bg-color;
		background: #3c9cff;
	}

	.over {
		background-color: #909399;
	}

	.text {
		font-size: 24rpx;
		// color: $btn-text-color;
		color: #fff;
	}

	.team-head {
		position: absolute;
		top: 0;
		left: 0;
		padding: 20rpx;
		justify-content: space-between;
		background: linear-gradient(180deg, #0E0F0F, transparent);

		.team-user {
			.ava {
				width: 68rpx;
				height: 68rpx;
				border-radius: 50%;
			}

			.user-name {
				font-weight: bold;
				font-size: 34rpx;
				// color: rgba(255, 255, 255, 1);
				color: $name-color;
				max-width: 320rpx;
				text-overflow: ellipsis;
				white-space: nowrap;
				lines: 1;
				overflow: hidden;
			}

			.lv-box {
				position: relative;
				margin-right: 24rpx;
				justify-content: flex-end;

				.lv-bg {
					width: 44rpx;
					height: 38rpx;
					margin-right: 4rpx;
				}

				.lv {
					font-weight: bold;
					font-size: 20rpx;
					color: #DD9E4F;
				}
			}

		}

		.description-right {
			.icon {
				width: 20rpx;
				height: 22rpx;
				margin-right: 4rpx;
			}

			.address {
				font-weight: 400;
				font-size: 24rpx;
				color: #94B2A7;
			}

			.interval {
				display: block;
				width: 2rpx;
				height: 20rpx;
				background-color: #ccc;
				margin: 0 16rpx;
			}

			.distanc {
				font-weight: 400;
				font-size: 24rpx;
				color: rgba(255, 255, 255, 0.6);
				// color: $distance-color;
			}
		}
	}

	.item-content {
		flex-direction: column;
		background-color: #0E0F0F;
		padding: 20rpx;

		.content-top {
			justify-content: space-between;
		}

		.item-name-box {
			flex: 1;
			margin-right: 18rpx;
			width: 45%;
		}

		.item-name {
			width: 100%;
			display: block;
			font-size: 26rpx;
			color: $description-color;
			text-overflow: ellipsis;
			white-space: nowrap;
			lines: 1;
			overflow: hidden;
			margin-left: 8rpx;
		}
	}

	.countdown-box {
		flex-shrink: 0;

		.time-box {
			margin-left: 6rpx;
		}

		.text {
			font-weight: 500;
			font-size: 24rpx;
			color: $description-color;
		}

		.time {
			font-weight: 500;
			font-size: 24rpx;
			color: $timer-color;
			margin: 0 6rpx;
		}
	}

	.item-details {
		justify-content: space-between;
		margin-top: 18rpx;

		.seat {
			font-size: 26rpx;
			color: $name-color;
			margin-right: 12rpx;
			// margin-right: 34rpx;
		}



		.details-info {
			.separation {
				margin: 0 16rpx;
				display: block;
				width: 1rpx;
				height: 60%;
				background-color: #94B2A7;
			}

		}

		.item-border-noActive {
			border: 3rpx solid #4A5C58;
		}

		.item-border-active {
			border: 3rpx solid #7EDE9E;
		}

		.price-box {
			color: $price-color;
			margin-right: 34rpx;

			.icon {
				font-size: 26rpx;
				margin-right: 4rpx;
			}

			.price {
				font-size: 32rpx;
			}

			.unit {
				font-size: 14rpx;
				// vertical-align: bottom;
			}
		}

		.item-btn {
			width: 100%;
			height: 62rpx;
			border-radius: 100rpx;
			flex: 1;
			box-sizing: border-box;

			.btn-left {
				flex: 1;
				color: $price-color;
				font-weight: bold;
				text-align: center;
				box-sizing: border-box;
				height: 100%;
				border-radius: 35rpx 0 35rpx 35rpx;
				position: relative;
				z-index: 9;
				background-color: #0E0F0F;


			}

			.btn-right {
				width: 172rpx;
				height: 100%;
				border-radius: 35rpx 35rpx 35rpx 0;
				background: $btn-bg-color;
				position: relative;

				&::before {
					content: '';
					width: 35rpx;
					height: 35rpx;
					background-color: #5FD1C1;
					position: absolute;
					bottom: 0;
					left: -32rpx;
					z-index: 1;
				}

				.text {
					font-weight: bold;
					font-size: 28rpx;
					color: $btn-text-color;
				}
			}

		}

	}
</style>